package com.yiyang.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yiyang.domain.ResultPage;
import com.yiyang.domain.po.NurseContent;
import com.yiyang.service.NurseContentService;
import com.yiyang.mapper.NurseContentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author 31044
* @description 针对表【nurse_content】的数据库操作Service实现
* @createDate 2024-10-08 11:41:21
*/
@Service
public class NurseContentServiceImpl extends ServiceImpl<NurseContentMapper, NurseContent>
    implements NurseContentService{

    @Autowired
    private NurseContentMapper nurseContentMapper;

    public ResultPage<NurseContent> findNurseItemPage(Integer page,Integer pageSize,String itemName,Integer status){
        Page<NurseContent> nurseContentPage = new Page<>(page,pageSize);

        LambdaQueryWrapper<NurseContent> lqw = new LambdaQueryWrapper<NurseContent>().eq(status != null, NurseContent::getStatus, status)
                .like(StringUtils.isNotEmpty(itemName), NurseContent::getNursingName, itemName);

        nurseContentMapper.selectPage(nurseContentPage,lqw);
        return new ResultPage<NurseContent>(nurseContentPage.getTotal(),nurseContentPage.getRecords());
    }

}
































